package com.shujia.hdfs;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.io.IOException;

public class Demo04CopyToLocalFile {
    public static void main(String[] args) throws IOException {
        Configuration conf = new Configuration();
        conf.set("fs.defaultFS", "hdfs://master:9000");
        FileSystem fs = FileSystem.get(conf);

        // 类似的moveToLocalFile，会删除HDFS的文件
        fs.copyToLocalFile(new Path("/user/root/words.txt"),new Path("hadoop/data/hdfs"));


    }
}
